﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace ASoft.Data
{
    [DataContract]
    public class PositionData
    {

        #region 温室位置

        [DataMember]
        List<PositionRoom> _PositionRooms;

        static object lockKey = new object();

        public List<PositionRoom> PositionRooms
        {
            get
            {
                if (_PositionRooms == null)
                {
                    _PositionRooms = new List<PositionRoom>();
                    for (byte i = 1; i < 255; i++)
                    {
                        _PositionRooms.Add(new PositionRoom() { Id = i, Left = 0, Top = 0 });
                    }
                }
                //if (_PositionRooms.Single(p => p.Id == 142).Top == 0)
                //{
                //    for (byte i = 142; i < 181 - 8; i++)
                //    {
                //        _PositionRooms.Single(p => p.Id == i).Top = _PositionRooms.Single(p => p.Id == 121).Top;
                //        _PositionRooms.Single(p => p.Id == i).Left = _PositionRooms.Single(p => p.Id == i - 120 + 8).Left;
                //    }
                //}

                return _PositionRooms;

            }
        }

        #endregion

        [DataMember]
        PositionWeatherStation _PositionWeatherStation;

        public PositionWeatherStation PositionWeatherStation
        {
            get
            {
                if (_PositionWeatherStation == null)
                {
                    _PositionWeatherStation = new PositionWeatherStation();
                }
                return _PositionWeatherStation;
            }
        }
    }
}
